from flask import Flask
from settings import map_config


# 负责创建App对象
def create_app(config_type):
    app = Flask(__name__)
    # 加载项目配置
    app.config.from_object(map_config.get(config_type))
    # 加载日志处理工具

    # 初始化SQLALCHEMY
    from comment.models import db
    db.init_app(app)
    # 加载模块蓝图
    from shopping.resource.user import user_bp
    app.register_blueprint(user_bp, urlprefix='/user')

    return app
